package com.jck.wx.web;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jck.dplus.common.annomapper.MybatisBaseDaoCRUD;

import lombok.extern.slf4j.Slf4j;


@Slf4j
@RestController
public class MyController2 {

	@Autowired
	public MybatisBaseDaoCRUD mBaseDao;

	/**
	 * showdoc
	* @catalog 用户操作
	* @title 用户注册
	* @description 用户注册
	* @method post   :json格式（例） {  "name": "焦竞", "phone": "15150125287", "mail": "986851760@qq.com", "password": "e10adc3949ba59abbe56e057f20f883e", "type":2,"hospitalName":"广济医院","signature": "587f4935053188628d9bfcf931fa376b"}
	* @url /user/registerUser
	* @param phone 必选 string 手机号  
	* @param name 必选 string 姓名
	* @param mail 必选 string 邮箱标准格式(123at163.com) 
	* @param password 必选 string 密码(md5加密一次字符串)  
	* @param type 必选 int 注册类型1：普通用户；2：医学人士  
	* @param hospitalName 可选 string 医院名称(type为2时必选) 
	* @param title 可选 string 职称(type为2时必选)  
	* @param signature 必选 string 签名（不为空参数依次按顺序拼接后md5加密2次后的字符串）  
	* @return {"errcode":"0","errmsg":"成功","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI0IiwiaWF0IjoxNTM0OTAzNDEzLCJleHAiOjE1MzQ5NDY2MTN9.WlhQ1-k6xfFmj8H9Lg1k-dbtyhTy76ay09HKbI4oTXRyUOzlKFPSKowGXW3JDI0mV6zJ3c3SmIYjpXkXhoasWg"}
	* @return_param errcode int 0为成功，其他失败（见概述：返回errcode说明）
	* @return_param errmsg string 信息
	* @return_param token string 访问令牌
	* @remark  无
	*/
	@GetMapping("/test")
	public Map hello() {
		Map map=new HashMap();
		// 返回的是ModelAndView对象;
//		ModelAndView mv = new ModelAndView("hello");
//		return mv;
		map.put("name", "jiaojing");
		map.put("list", Arrays.asList("s1", "s2"));
		return map;
	}

	
	@GetMapping("/test1")
	public Map test1() {
		Map map=new HashMap();
		String sql = " select * from  area limit 1";
		List l = mBaseDao.findBySql(sql, null, null);
		map.put("list",l);
		return map;
	}
	@GetMapping("/test2")
	public Map test2(HttpServletRequest res) {
		System.out.println(res.getParameter("state"));
		System.out.println(res.getParameter("code"));
		Map map=new HashMap();
		 
		return map;
	}

}